package com.learn;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @Description:数据泛型
 */
public class TestGenericCase {
    public static void main(String[]  args) {
        swap(new String[] { "abc", "123", "xdp" }, 1, 2);
    }

    private static  <T> void swap (T[] a , int i, int j ) {
        pringArray( a );
        T tmep = a[i];
        a[i] = a[j];
        a[j] = tmep;
        pringArray( a );

    }

    private static  <T> void pringArray(T[] array ) {
        for ( T t: array ) {
            System.out.println(t+"\n");
        }
    }
}
